<template>
  <footer class="footer">
    <div class="container">
      <div class="footer-content">
        <div class="footer-section">
          <div class="footer-logo">
            <i class="fas fa-brain"></i>
            <span>智索真源</span>
          </div>
          <p>AI驱动的智能任务匹配平台，为企业数字化转型提供智能化解决方案。</p>
          <div class="social-links">
            <div class="wechat-container">
              <a href="#" class="wechat-link"><i class="fab fa-weixin"></i></a>
              <div class="wechat-qr">
                <img src="../assets/static/F57372D8A83209F1BAA84E4E2A1675EA.jpg" alt="微信二维码" />
                <p>扫码添加微信</p>
              </div>
            </div>
            <div class="weibo-container">
              <a href="#" class="weibo-link"><i class="fab fa-weibo"></i></a>
              <div class="weibo-qr">
                <img src="../assets/static/9F87A7719FF7DA76F0678631B99D5452.jpg" alt="微博二维码" />
                <p>扫码关注微博</p>
              </div>
            </div>
          </div>
        </div>
        <div class="footer-section">
          <h4>产品服务</h4>
          <ul>
            <li><a href="/" @click="navigateToSection('products')">智能任务匹配</a></li>
            <li><a href="/" @click="navigateToSection('products')">能力认证</a></li>
            <li><a href="/" @click="navigateToSection('products')">区块链存证</a></li>
          </ul>
        </div>
        <div class="footer-section">
          <h4>解决方案</h4>
          <ul>
            <li><a href="/" @click="navigateToSection('solutions', 'computer')">计算机行业</a></li>
            <li><a href="/" @click="navigateToSection('solutions', 'machinery')">机械制造业</a></li>
            <li><a href="/" @click="navigateToSection('solutions', 'biomedical')">生物医学行业</a></li>
          </ul>
        </div>
        <div class="footer-section">
          <h4>联系我们</h4>
          <ul>
            <li><a href="/" @click="navigateToSection('contact')">联系方式</a></li>
            <li><a href="#" @click="navigateToSection('contact')">技术支持</a></li>
            <li><a href="#" @click="navigateToSection('contact')">隐私政策</a></li>
          </ul>
        </div>
      </div>
      <div class="footer-bottom">
        <p>&copy; 2024 智索真源. 保留所有权利.</p>
      </div>
    </div>
  </footer>
</template>

<script>
export default {
  name: 'FooterSection',
  methods: {
    navigateToSection(sectionId, industryId = null) {
      event.preventDefault()
      
      if (this.$route.path !== '/') {
        // 如果不在首页，先跳转到首页
        this.$router.push('/').then(() => {
          // 等待页面加载完成后滚动到指定section
          setTimeout(() => {
            this.scrollToSection(sectionId, industryId)
          }, 100)
        })
      } else {
        // 如果已经在首页，直接滚动到指定section
        this.scrollToSection(sectionId, industryId)
      }
    },
    scrollToSection(sectionId, industryId = null) {
      const element = document.getElementById(sectionId)
      if (element) {
        element.scrollIntoView({ 
          behavior: 'smooth',
          block: 'start'
        })
        
        // 如果有行业ID，触发自定义事件来激活对应的行业标签
        if (industryId) {
          setTimeout(() => {
            this.$emit('activate-industry', industryId)
          }, 500) // 延迟500ms确保滚动完成后再激活标签
        }
      }
    }
  }
}
</script>

<style scoped>
.footer {
  background: rgba(15, 15, 35, 0.95);
  backdrop-filter: blur(20px);
  color: white;
  padding: 3rem 0 1rem;
  border-top: 1px solid rgba(59, 130, 246, 0.2);
  position: relative;
  z-index: 10; /* 确保Footer在Contact之上 */
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-logo {
  display: flex;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.footer-logo i {
  margin-right: 10px;
  color: #3b82f6;
  text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.footer-section p {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.footer-section h4 {
  margin-bottom: 1rem;
  color: white;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-section ul li a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-section ul li a:hover {
  color: #3b82f6;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-links a {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.social-links a:hover {
  background: #3b82f6;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

/* 微信二维码悬停效果 */
.wechat-container {
  position: relative;
  display: inline-block;
  z-index: 10000; /* 确保容器有足够高的z-index */
}

.wechat-link {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.wechat-link:hover {
  background: #3b82f6;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.wechat-qr {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 9999; /* 提高z-index确保在最上层 */
  min-width: 250px;
  text-align: center;
  pointer-events: auto; /* 确保可以交互 */
}

.wechat-qr::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: white;
}

.wechat-container:hover .wechat-qr {
  opacity: 1;
  visibility: visible;
}

.wechat-qr img {
  width: 200px;
  height: 200px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.wechat-qr p {
  color: #333;
  font-size: 14px;
  margin: 0;
  font-weight: 500;
}

/* 微博二维码悬停效果 */
.weibo-container {
  position: relative;
  display: inline-block;
  z-index: 10000; /* 确保容器有足够高的z-index */
}

.weibo-link {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.weibo-link:hover {
  background: #3b82f6;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.weibo-qr {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 9999; /* 提高z-index确保在最上层 */
  min-width: 250px;
  text-align: center;
  pointer-events: auto; /* 确保可以交互 */
}

.weibo-qr::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: white;
}

.weibo-container:hover .weibo-qr {
  opacity: 1;
  visibility: visible;
}

.weibo-qr img {
  width: 200px;
  height: 200px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.weibo-qr p {
  color: #333;
  font-size: 14px;
  margin: 0;
  font-weight: 500;
}

.footer-bottom {
  border-top: 1px solid rgba(59, 130, 246, 0.2);
  padding-top: 1rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
}

@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
}
</style>
